import './Table/tableConfig.css'


// 列
export const getColumsTable = (
    callbackTableData
) => {
    const column = [
        {
            title: '序号',
            dataIndex: 'env_key',
            key: '1',
            width: '200px',
            editable: true,
            // fixed: 'left',
            render: (text, record) => {
                return <div className="tableStyle">
                    {text ? text : "此处无数据"}
                </div>
            }

        },
        {
            title: '变量值',
            dataIndex: 'env_value',
            key: '2',
            width: '200px',
            editable: true,
            render: (text) => {
                return <div className="tableStyle">
                    {text ? text : "此处无数据"}
                </div>
            }
        },
        {
            title: '年龄',
            dataIndex: 'age',
            key: '6',
            width: '200px',
            editable: true,
            sorter: (a, b) => a.age - b.age,
            render: (text, record) => {
                return <div className="tableStyle">
                    {record.age == 12 ? <span style={{ color: 'red' }}>{record.age}</span> : record.age}
                    {/* {text ? text : "此处无数据"} */}
                </div>
            }
        },
        {
            title: '性别',
            dataIndex: 'nax',
            key: '7',
            width: '200px',
            editable: true,
            render: (text, record) => {
                return <div className="tableStyle">
                    {/* {text ? text : "此处无数据"} */}
                    {record.nax === '男' ? <span style={{ color: 'aqua' }}>{record.nax}</span> : record.nax}
                </div>
            }
        },
        {
            title: '说明',
            dataIndex: 'env_explain',
            key: '3',
            // width: '25%',
            editable: true,
            render: (text) => {
                var a = <div style={{ color: 'red' }}>此处无数据</div>
                return <div className="tableStyle">
                    {text ? text : a}
                </div>
            },

        },
        {
            title: '操作',
            key: '操作',
            fixed: 'right',
            width: '140px',
            align: 'center',
            render: (_, record) => (
                <div style={{ display: 'flex', justifyContent: 'space-around', alignItems: 'center' }}>
                    <div><a onClick={() => { callbackTableData(record) }}>log数据 {record.name}</a></div>
                    <div><a style={{ color: 'red' }}>删除</a></div>
                </div>
            ),
        },
    ];
    return column;
}

// 数据
export const getColumsData = () => {
    const env_management = [
        { key: 1, age: 12, nax: '女', env_key: 'LINKERD2_PROXY_LOG', env_value: 'warn,linkerd=info', env_explain: '' },
        { key: 2, age: 22, nax: '男', env_key: 'LINKERD2_PROXY_LOG_FORMAT', env_value: 'plain', env_explain: '' },
        { key: 3, age: 22, nax: '女', env_key: 'LINKERD2_PROXY_DESTINATION_SVC_ADDR', env_value: 'linkerd-dst-headless.linkerd.svc.cluster.local.:8086', env_explain: '' },
        { key: 4, age: 22, nax: '男', env_key: 'LINKERD2_PROXY_DESTINATION_PROFILE_NETWORKS', env_value: '10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16', env_explain: '' },
        { key: 5, age: 22, nax: '女', env_key: 'LINKERD2_PROXY_POLICY_SVC_ADDR', env_value: 'linkerd-policy.linkerd.svc.cluster.local.:8090', env_explain: '' },
        { key: 6, age: 22, nax: '男', env_key: 'LINKERD2_PROX2_YxxxxxxxORKLOAD', env_value: '$(_pod_ns):$(_pod_name)', env_explain: '' },
        { key: 7, age: 22, nax: '男', env_key: 'LINKERD2_PROXY_INBOUND_DEFAULT_POLICY', env_value: 'all-unauthenticated', env_explain: '' },
        { key: 8, age: 22, nax: '男', env_key: 'LINKERD2_PROXY_POLICY_CLUSTER_NETWORKS', env_value: '10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16', env_explain: '' },
        { key: 9, age: 22, nax: '男', env_key: 'LINKERD2_PROXY_INBOUND_CONNECT_TIMEOUT', env_value: '100ms', env_explain: '' },
        { key: 10, age: 22, nax: '男', env_key: 'LINKERD2_PROXY_OUTBOUND_CONNECT_TIMEOUT', env_value: '1000ms', env_explain: '' },
        { key: 11, age: 22, nax: '男', env_key: 'LINKERD2_PROXY_CONTROL_LISTEN_ADDR', env_value: '0.0.0.0:4190', env_explain: '' }
    ]
    return env_management;
}
